using RayDen.Library.Core;
using RayDen.Library.Entity.Scene;

namespace RayDen.Library.Components.Surface
{
    public class BrdfClassNameMapper
    {

        public static BrdfClass GetMaterialClass(MaterialInfo materialInfo)
        {

            if (materialInfo.Name.NameContains("orennayar", "oren_nayar", "_M_OR"))
            {
                return BrdfClass.OrenNayar;
            }


            if (materialInfo.Name.NameContains1("anisotropicphong", 
                "_M_AS"))
            {
                return BrdfClass.AnisotropicPhong;
            }

            if (materialInfo.Name.NameContains("measured"
                , "head_mat"
                , "_M_RHA_"))
            {
                return BrdfClass.Measured;
            }

            if (materialInfo.Name.NameContains("experimental", "_M_XP"))
            {
                return BrdfClass.Experimental;
            }

            if (materialInfo.Name.NameContains(
                "Ruby",
                "Emerald",
                                   "bunny",
                                  "garg_mat",
                                  "cornell_exp_mat",
                                            "glass",
                                            "wire_135059008",
                                               "wire_060134005",
                                               "staklo",
                                               "wire_140088225",
                                               "wire_154215229",
                                               "wire_228153184",
                                               "wire_057008136",
                                               "__SILVER",
                                               "simple_metal_1",
                                               "wire_000000000",
                                               "wire_200157056",
                                               "wire_113134006",
                                               "wire_134110008",
                                               "water",
                                               "_M_GLS",
                    "wire_141182235"))
            {

                return BrdfClass.Glass;
            }

            if (materialInfo.Name.NameContains(
                "Saphire",
                "arch",
                "_M_AGLS",
                "wire_008061138", "wire_213228166", "wire_134110008", "wire_028149177",
                "Material__29"))
            {
                return BrdfClass.ArchGlass;
            }
            if (!materialInfo.GlossReflectance.IsBlack() && materialInfo.Name.NameContains("metal",
                "wire_028089177",
                "_M_MTL",
                "chrome",
                "inside", 
                "reflection",
                 "wire_177088026", "wire_153228184", "wire_153228214", "wire_028089177"
            ))
            {
                return BrdfClass.GlossyMetal;
            }
            if (!materialInfo.GlossReflectance.IsBlack() && materialInfo.Name.NameContains("alloy"
                 , "mmix",
                 "_M_ALO",
                 "porcelain",
                 "marble",
                 "gloss",
                 "plastic",
                 "ceramic",
                  "wire_008008136"
                ))
            {
                return BrdfClass.Alloy;
            }
            if (materialInfo.Name.NameContains("mirror",
                "_M_MIR",
                "wire_154154229"))
            {
                return BrdfClass.Mirror;
            }
            if (materialInfo.Name.NameContains("matmir",
                "_M_MMR",
                "wire_087224087"))
            {
                return BrdfClass.MatteMirror;
            }

            if (materialInfo.Name.NameContains("MaterialView_Test",
                //"phong",
               "mitsuba",
               "blinn",
                 "_M_DST",
                "wire_088144225"

                ))
            {
                return BrdfClass.Distribution;
            }


            if (materialInfo.Name.NameContains("wire_229166215", "wire_060134005"))
            {
                return BrdfClass.ArchGlass;
            }
            return BrdfClass.DiffuseLambert;
        }
    }
}